import { request } from '@/utils/http'
import {
  IhospitalListPrams,
  IhospitalListsResponse,
  IcodeListsResponse,
  IhosdetailRespone,
  ProvinceList,
  IdepartmentType,
  IgetScheduleRule,
  IsheduleControllerType,
} from '@api/hospital/model/hospitalListTypes'

//获取医院列表的请求
export function reqHospitalLists({
  page,
  limit,
  hosname,
  hoscode,
  hostype,
  provinceCode,
  cityCode,
  districtCode,
  status,
}: IhospitalListPrams) {
  return request.get<any, IhospitalListsResponse>(
    `/admin/hosp/hospital/${page}/${limit}`,
    {
      params: {
        hosname,
        hoscode,
        hostype,
        provinceCode,
        cityCode,
        districtCode,
        status,
      },
    }
  )
}

export function reqCodeLists(code: string) {
  return request.get<any, ProvinceList>(
    `/admin/cmn/dict/findByDictCode/${code}`
  )
}

export function reqDictLists(id: string) {
  return request.get<any, ProvinceList | any>(`/admin/cmn/dict/findByParentId/${id}`)
}

export function reqHosDetail(id: string) {
  return request.get<any, IhosdetailRespone>(`/admin/hosp/hospital/show/${id}`)
}

//更新医院上线状态
export function reqUpdateStatus(id: string, status: number) {
  return request.get<any, IhosdetailRespone>(
    `/admin/hosp/hospital/updateStatus/${id}/${status}`
  )
}

//获取所有科室数据
export function reqDepartment(hoscode: string) {
  return request.get<any, IdepartmentType>(`/admin/hosp/department/${hoscode}`)
}

//获取门诊的排班时间
export function reqBookingScheduleList(
  page: number,
  pageSize: number,
  hoscode: string,
  depcode: string
) {
  return request.get<any, IgetScheduleRule>(
    `/admin/hosp/schedule/getScheduleRule/${page}/${pageSize}/${hoscode}/${depcode}`
  )
}

//获得每日排班管理详情
export function reqScheduleController(
  hoscode: string,
  depcode: string,
  workDate: string,
) {
  return request.get<any, IsheduleControllerType>(
    `/admin/hosp/schedule/findScheduleList/${hoscode}/${depcode}/${workDate}`
  )
}
